home *** CD-ROM | disk | FTP | other *** search
- Path: haystack.physio-control.com!usenet
- From: Brian Reese <breese@kahuna>
- Newsgroups: comp.lang.c
- Subject: Re: Converting Strings to Upper Case
- Date: Mon, 18 Mar 96 13:24:05 PDT
- Organization: Physio Control, Inc.
- Message-ID: <NEWTNews.827184423.14391.breese@PC_Breese.physio-control>
- References: <4ifra6$52i@scipio.cyberstore.ca> <4ih7l3$526@thrush.sover.net> <4ihl4m$4ca@castle.nando.net>
- NNTP-Posting-Host: pc_breese.physio-control.com
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage
-
-
- Here's my offering:
-
- #include <stdio.h> /* for printf() */
- #include <ctype.h> /* for toupper() */
-
- char * strtoupper( char * ); /* converts string to upper case */
-
- int main( void )
- {
- char * test = "my test string";
-
- printf( "%s\n", test );
- printf( "%s\n", strtoupper( test ) );
-
- return 0;
- }
-
- char * strtoupper( char * ptr ) /* converts string to upper case */
- {
- char * save_ptr = ptr; /* save pointer for return */
-
- while ( *ptr = toupper( *ptr++ ) )
- ;
- return save_ptr;
- }
-
-
-